package de.ars.client.items.animators;

import de.ars.client.animator.AbstractSlideItemAnimator;
import de.ars.client.animator.IAnimationEventListener;
import de.ars.client.paintSystems.ClassicLayout;

public class SyncWithCsvAnimator extends AbstractSlideItemAnimator
{
	public static final float STANDARD_ANIMATION_SPEED = 2.5f;
    public static final float STANDARD_SCROLL_SPEED = 10.0f;
    
    public static final int POINT_SYNC_WITH_CSV_POS = 0;
    public static final int POINT_SYNC_WITH_CSV_SIZE = 1;
    public static final int POINT_SYNC_WITH_CSV_TEXT_POS = 2;
    
	private ClassicLayout layout;
	
	public SyncWithCsvAnimator(IAnimationEventListener listener) 
	{
		super(listener);
	}
	
	public void setLayout(ClassicLayout layout)
    {
		this.layout = layout;
    }
	
	public void openItem()
	{
		this.startAnimationTo(POINT_SYNC_WITH_CSV_POS, this.layout.getAddPersonPos(), STANDARD_ANIMATION_SPEED);
		this.startAnimationTo(POINT_SYNC_WITH_CSV_TEXT_POS, this.layout.getAddPersonTextPos(), STANDARD_ANIMATION_SPEED);
		
		listener.animationEvent(IAnimationEventListener.ANIMATION_STARTED);
	}
	
	public void closeItem()
	{
		this.startAnimationTo(POINT_SYNC_WITH_CSV_POS, this.layout.getAddPersonClosePos(), STANDARD_ANIMATION_SPEED);
		this.startAnimationTo(POINT_SYNC_WITH_CSV_TEXT_POS, this.layout.getAddPersonCloseTextPos(), STANDARD_ANIMATION_SPEED);
		
		listener.animationEvent(IAnimationEventListener.ANIMATION_STARTED);
	}
}